//
//  JHJSongsCell.m
//  DayByDay
//
//  Created by dllo on 16/5/22.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "JHJSongsCell.h"

@interface JHJSongsCell ()

@property (nonatomic, strong)UILabel *songNameLabel;
@property (nonatomic, strong)UILabel *songerNameLabel;
//@property (nonatomic, strong)UIImageView *playImageView;


@end

@implementation JHJSongsCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return self;
}

- (void)setModel:(CellSongsModel *)model {
    _model = model;
    NSString *string = [NSString stringWithFormat:@"%@%@",_model.name, _model.alias];
    self.songNameLabel.text = string;
    self.songerNameLabel.text = _model.singerName;
    if (self.isClick) {
        self.playImageView.image = [UIImage imageNamed:@"cm2_discover_icn_music-1"];
    } else {
        self.playImageView.image = [UIImage imageNamed:@"cm2_discover_icn_mv"];
    }
//    self.playImageView.image = [UIImage imageNamed:@"cm2_discover_icn_mv"];
    
}

- (void)createView {
    self.numberLabel = [UILabel new];
    [self.contentView addSubview:self.numberLabel];
    self.songNameLabel = [UILabel new];
    [self.contentView addSubview:self.songNameLabel];
    self.songerNameLabel = [UILabel new];
    [self.contentView addSubview:self.songerNameLabel];
    self.backgroundColor = [UIColor clearColor];
    self.playImageView = [UIImageView new];
    [self.contentView addSubview:self.playImageView];
    self.playImageView.image = [UIImage imageNamed:@"cm2_discover_icn_mv"];
}

- (void)layoutSubviews {
    [super layoutSubviews];
    self.numberLabel.frame = CGRectMake(10, 5,  40, 40);
    self.songNameLabel.frame = CGRectMake(60, 5, WIDTH - 150, 20);
    self.songerNameLabel.frame = CGRectMake(60, 30, WIDTH - 150, 20);
    self.playImageView.frame = CGRectMake(WIDTH - 50, 5, 25, 25);
    self.playImageView.center = CGPointMake(WIDTH - 50, self.contentView.center.y);
}


@end
